﻿package mortal.game.view.rebate.data
{
    import Message.Game.*;
    import flash.utils.*;

    public class RebateCache extends Object
    {
        public var oneSevenType:int;
        public var comOtherType:int;
        public var hasOneSevenReward:int;
        public var hasDayTargetReward:int;
        public var remainInfo:Object;
        public var playerInfo:Object;
        public var curShopId:int = -1;
        public var dayRechargeInfo:SRechargeReturnRewardInfo;
        public var rechargeSum:int = 0;
        public var curLevel:int = -1;
        public var dayTargetLevelObj:Dictionary;

        public function RebateCache()
        {
            this.remainInfo = {};
            this.playerInfo = {};
            return;
        }// end function

        public function updateGoodsRemainNum(param1:SOnsellItemsMsg) : void
        {
            var _loc_4:SOnSellItem = null;
            if (param1 == null)
            {
                return;
            }
            this.curShopId = param1.shopCode;
            var _loc_2:* = param1.items;
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2.length)
            {
                
                _loc_4 = _loc_2[_loc_3];
                this.remainInfo[param1.shopCode + "_" + _loc_4.itemCode] = _loc_4;
                _loc_3++;
            }
            return;
        }// end function

        public function updatePlayerBuyNum(param1:SOnSellItemsPlayerMsg) : void
        {
            var _loc_4:SOnSellItemPlayer = null;
            if (param1 == null)
            {
                return;
            }
            this.curShopId = param1.shopCode;
            var _loc_2:* = param1.buyShop;
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2.length)
            {
                
                _loc_4 = _loc_2[_loc_3];
                this.playerInfo[param1.shopCode + "_" + _loc_4.itemCode] = _loc_4;
                _loc_3++;
            }
            return;
        }// end function

        public function updateDayRecharge(param1:SRechargeReturnRewardInfo) : void
        {
            this.dayRechargeInfo = param1;
            this.rechargeSum = this.dayRechargeInfo.recharge;
            return;
        }// end function

        public function getDayRechargeBack(param1:int) : void
        {
            if (this.dayRechargeInfo)
            {
                (this.dayRechargeInfo.rewardInfo[param1] + 1);
            }
            return;
        }// end function

        public function hasDayRechargeReward() : Boolean
        {
            var _loc_1:* = RebateUtil.dayRechargeArr;
            var _loc_2:int = 0;
            while (_loc_2 < _loc_1.length)
            {
                
                if (this.hasOneDayRecharge(_loc_2))
                {
                    return true;
                }
                _loc_2++;
            }
            return false;
        }// end function

        public function hasGetAllDayRechargeReward() : Boolean
        {
            var _loc_1:* = RebateUtil.dayRechargeArr;
            var _loc_2:int = 0;
            while (_loc_2 < _loc_1.length)
            {
                
                if (!this.hasGetOneDayRecharge(_loc_2))
                {
                    return false;
                }
                _loc_2++;
            }
            return true;
        }// end function

        public function hasOneDayRecharge(param1:int) : Boolean
        {
            var _loc_2:* = RebateUtil.dayRechargeArr[param1];
            if (this.dayRechargeInfo == null)
            {
                return false;
            }
            var _loc_3:* = RebateUtil.getRwState(param1);
            return _loc_3[0] == 1;
        }// end function

        public function hasGetOneDayRecharge(param1:int) : Boolean
        {
            var _loc_2:* = RebateUtil.dayRechargeArr[param1];
            if (this.dayRechargeInfo == null)
            {
                return false;
            }
            var _loc_3:* = RebateUtil.getRwState(param1);
            return _loc_3[0] == 0;
        }// end function

    }
}
